package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BaiFunMapper;
import com.ruoyi.system.domain.BaiFun;
import com.ruoyi.system.service.IBaiFunService;

/**
 * 趣闻Service业务层处理
 * 
 * @author saruri
 * @date 2024-07-21
 */
@Service
public class BaiFunServiceImpl implements IBaiFunService 
{
    @Autowired
    private BaiFunMapper baiFunMapper;

    /**
     * 查询趣闻
     * 
     * @param id 趣闻主键
     * @return 趣闻
     */
    @Override
    public BaiFun selectBaiFunById(Long id)
    {
        return baiFunMapper.selectBaiFunById(id);
    }

    /**
     * 查询趣闻列表
     * 
     * @param baiFun 趣闻
     * @return 趣闻
     */
    @Override
    public List<BaiFun> selectBaiFunList(BaiFun baiFun)
    {
        return baiFunMapper.selectBaiFunList(baiFun);
    }

    /**
     * 新增趣闻
     * 
     * @param baiFun 趣闻
     * @return 结果
     */
    @Override
    public int insertBaiFun(BaiFun baiFun)
    {
        baiFun.setCreateTime(DateUtils.getNowDate());
        return baiFunMapper.insertBaiFun(baiFun);
    }
    /**
     * 查询医学趣闻上一条
     *
     * @param id 医学趣闻主键
     * @return 医学趣闻上一条
     */
    @Override
    public BaiFun selectBaiFunPrevById(Long id)
    {
        return baiFunMapper.selectPrevBaiFunById(id);
    }


    /**
     * 查询医学趣闻下一条
     *
     * @param id 医学趣闻主键
     * @return 医学趣闻下一条
     */
    @Override
    public BaiFun selectBaiFunNextById(Long id)
    {
        return baiFunMapper.selectNextBaiFunById(id);
    }


    /**
     * 查询最新医学趣闻
     *
     * @return 医学趣闻
     */
    @Override
    public BaiFun selectBaiFunNew()
    {
        return baiFunMapper.selectBaiFunNew();
    }


    /**
     * 修改趣闻
     * 
     * @param baiFun 趣闻
     * @return 结果
     */
    @Override
    public int updateBaiFun(BaiFun baiFun)
    {
        return baiFunMapper.updateBaiFun(baiFun);
    }

    /**
     * 批量删除趣闻
     * 
     * @param ids 需要删除的趣闻主键
     * @return 结果
     */
    @Override
    public int deleteBaiFunByIds(Long[] ids)
    {
        return baiFunMapper.deleteBaiFunByIds(ids);
    }

    /**
     * 删除趣闻信息
     * 
     * @param id 趣闻主键
     * @return 结果
     */
    @Override
    public int deleteBaiFunById(Long id)
    {
        return baiFunMapper.deleteBaiFunById(id);
    }
}
